home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #2 / Ham Radio 2000 - Volume 2.iso / HAMV2 / MISC / HCAL-27 / DISHMATH.BAS (.txt) < prev    next >
Encoding:
GW-BASIC  |  1996-10-28  |  3.2 KB  |  116 lines

  1. 10  'DISHMATH - rev. 29 OCT 96  adapted from PARABOLA program
  2. 20  CLS:KEY OFF
  3. 30  COMMON EX$
  4. 40  COLOR 7,0,1:
  5. 50  SCREEN 0
  6. 60  FO=0:LG=0:HT=0:FA=0
  7. 70  COLOR 7,0,1
  8. 80  PI=3.14159
  9. 90  U$=STRING$(80,205)
  10. 100  COLOR 15,2
  11. 110  PRINT " PARABOLIC CURVE";TAB(57)"by George Murphy VE3ERP ";
  12. 120  COLOR 1,0
  13. 130  PRINT STRING$(80,223);
  14. 140  COLOR 7,0
  15. 150  PRINT " WARNING! If your computer configuration does not support high"
  16. 160  PRINT " resolution graphics then this program may produce some uncanny"
  17. 170  PRINT " displays, or it may not work at all..........................."
  18. 180  PRINT U$;
  19. 190  PRINT " Press number in < > to:
  20. 200  PRINT U$;
  21. 210  PRINT "  < 1 >  DRAW a parabolic curve"
  22. 220  PRINT "  < 0 >  RETURN to menu"
  23. 230  Z$=INKEY$:IF Z$="0"THEN CLS:CHAIN"\bas\prog\dishant"
  24. 240  IF Z$="1"THEN 250 ELSE 230
  25. 250  VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
  26. 260  GOSUB 900:PRINT U$;
  27. 270  IF FO=0 THEN INPUT " ENTER: Focus:  (X-axis) .....";FO:GOSUB 320
  28. 280  IF LG=0 THEN INPUT " ENTER: Depth:  (X-axis) .....";LG:GOSUB 320
  29. 290  IF HT=0 THEN INPUT " ENTER: Height: (Y-axis) .....";HT:GOSUB 320
  30. 300  IF FO*LG*HT THEN 370 ELSE 270
  31. 310  '
  32. 320  IF FO=0 THEN IF HT*LG THEN FO=HT^2/(4*LG)
  33. 330  IF LG=0 THEN IF FO*HT THEN LG=HT^2/(4*FO)
  34. 340  IF HT=0 THEN IF FO*LG THEN HT=SQR(4*FO*LG)
  35. 350  RETURN
  36. 360  '
  37. 370  '.....calculate focal angle
  38. 375  COLOR 15,1
  39. 380  'X=640                   'hi-res screen length in pixels
  40. 390  'Y=350                   'hi-res screen height in pixels
  41. 400  'R=Y/X                   'height/width ratio
  42. 410  R=0.75    'ratio for SVGA monitor
  43. 420  IF FA=0 THEN FA=ATN(HT/(FO-LG))
  44. 430  IF FA<0 THEN FA=PI+FA
  45. 440  GOTO 490
  46. 450  '
  47. 460  H=HT*S:F=FO*S:L=LG*S
  48. 470  RETURN
  49. 480  '
  50. 490  S=150/HT:GOSUB 460
  51. 500  IF F>(450*R) THEN S=450*R/FO:GOSUB 460
  52. 510  IF L>(450*R) THEN S=450*R/LG:GOSUB 460:GOTO 500
  53. 520  IF H>150 THEN S=150/H:GOSUB 460:GOTO 500
  54. 530  '
  55. 540  X=10:Y=250
  56. 550  SCREEN 9:COLOR 15,1:PRINT " PARABOLIC CURVE:
  57. 560  PRINT " o = Focal Point"
  58. 570  PSET (X,Y)
  59. 580  '
  60. 590  FOR Z=1 TO H
  61. 600  A=Z^2/(4*F)/R
  62. 610  PSET (X+A,Y-Z)
  63. 620  NEXT Z
  64. 630  LINE(X,Y)-(L/R+X,Y)
  65. 640  FF=F/R:LINE-(FF+X,Y),,,&H5555
  66. 650  LINE(L/R+X,Y-2)-(L/R+X,Y+2)
  67. 660  CIRCLE (FF+X,Y),4
  68. 670  CIRCLE (L/R+X,Y-H),2  'END OF CURVE
  69. 680  W=H/2:P=W^2/(4*F)/R
  70. 690  IF F>L THEN E=F ELSE E=L
  71. 700  E=E/R
  72. 710  LINE (FF+X,Y)-(P+X,Y-W),,,&H5555
  73. 720  LINE -(480,Y-W),,,&H1111
  74. 730  LINE (FF+X,Y)-(L/R+X,Y-H),,,&H5555
  75. 740  LINE -(480,Y-H),,,&H1111
  76. 750  FOR Z=6 TO H STEP 6
  77. 760  PSET(L/R+X,Y-Z):NEXT Z
  78. 770  CIRCLE (FF+X,Y),FF/3,,PI-FA,PI,R
  79. 780  LOCATE 22:PRINT " Focus=";FO;"  Height=";HT;"  Depth=";LG;
  80. 790  PRINT "  Acceptance Angle= ";USING "###.#";FA*180/PI;:PRINT CHR$(248)
  81. 800  Q=2
  82. 810  LOCATE 23:
  83. 820  INPUT " ENTER 0 to exit or value of Y (height) to plot X (depth): ";T
  84. 830  LOCATE 23:PRINT STRING$(80,32);
  85. 840  IF T=0 THEN 50 ELSE LOCATE 1,58:PRINT "X";TAB(72);"Y"
  86. 850  V=T^2/4/FO:N=(V*S)/R+X
  87. 860  LINE (N,Y)-(N,Y-T*S)
  88. 870  Q=Q+1:LOCATE Q,57:PRINT V;TAB(71);T
  89. 880  GOTO 810
  90. 890  '
  91. 900  '.....preface
  92. 910  TB=7
  93. 920  PRINT TAB(TB);
  94. 930  PRINT "The formula for plotting a parabolic curve is X=Y<UNK! {FD2F}>4F, where X is"
  95. 940  PRINT TAB(TB);
  96. 950  PRINT "the depth, Y is the height, and F is the focus. Enter any two of"
  97. 960  PRINT TAB(TB);
  98. 970  PRINT "these values to find the third value and to plot an appropriately"
  99. 980  PRINT TAB(TB);
  100. 990  PRINT "scaled parabolic curve."
  101. 1000  PRINT
  102. 1010  PRINT TAB(TB);
  103. 1020  PRINT "In terms of practical parabolic reflectors depth X is the distance"
  104. 1030  PRINT TAB(TB);
  105. 1040  PRINT "from the back of the dish to the plane formed by the rim of the"
  106. 1050  PRINT TAB(TB);
  107. 1060  PRINT "dish, height Y is the radius of the rim, focus F is the distance"
  108. 1070  PRINT TAB(TB);
  109. 1080  PRINT "along the dish axis from the back of the dish to the focal point."
  110. 1090  PRINT
  111. 1100  PRINT TAB(TB);
  112. 1110  PRINT "The focal point is the location of the lamp in a spotlight, the"
  113. 1120  PRINT TAB(TB);
  114. 1130  PRINT "antenna in an RF reflector, and the microphone in an audio snooper."
  115. 1140  RETURN
  116.